package com.dehui.traders.ui.stockdetail.adapter;

import android.content.Context;
import android.widget.TextView;

import com.dehui.traders.R;
import com.dehui.traders.bean.FinancialData;
import com.dehui.traders.widgets.BaseViewHolder;
import com.dehui.traders.widgets.CommonAdapter;

import java.util.List;

import me.goldze.mvvmhabit.utils.Utils;

public class FinancialLiRunAdapter extends CommonAdapter<String>{


    private final FinancialData fd;

    public FinancialLiRunAdapter(Context context, List<String> mDatas, int itemLayoutId, FinancialData fd) {
        super(context, mDatas, itemLayoutId);
        this.fd = fd;
    }

    @Override
    public void convert(BaseViewHolder helper, String item, int position) {

        TextView tvTitle = helper.getView(R.id.tv_title);
        TextView tvContent = helper.getView(R.id.tv_content);
        tvTitle.setText(item);
        if (fd == null)
            return;
        String content = "";
        switch (position){
            case 0:
                content = fd.getF009N();
                break;
            case 1:
                content = fd.getF011N();
                break;
            case 2:
//                content = fd.getf();
                break;
            case 3:
                content = fd.getF019N();
                break;
            case 4:
                content = fd.getF037N();
                break;
            case 5:
                content = fd.getF025N();
                break;
            case 6:
                content = fd.getF038N();
                break;
            case 7:
                content = fd.getF042N();
                break;
            case 8:
                content = fd.getF048N();
                break;
            case 9:
//                content = fd.getF051N();
                break;
            case 10:
                content = fd.getF052N();
                break;

        }
        try {
            Float aFloat = Float.valueOf(content);
            content = Utils.doubleToString(aFloat / 10000) + "万元";
        }catch (Exception e){

        }

        tvContent.setText(content);

    }
}
